package org.sikyon.chocolatebiscuit.datamarket.inmemory;

import org.sikyon.chocolatebiscuit.datamarket.AbstractMarket;
import org.sikyon.chocolatebiscuit.datamarket.Store;
import org.sikyon.chocolatebiscuit.model.entities.Identifiable;
import org.sikyon.chocolatebiscuit.model.entities.User;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class InMemoryMarket extends AbstractMarket {

    // temporarily just a Set of Users
    static Set<User> users = new HashSet<User>();

    static Set<User> users() {
        return users;
    }

    private Map<Class<? extends Identifiable<?>>, Store<? extends Identifiable<?>, ?>> stores = new HashMap<Class<? extends Identifiable<?>>, Store<? extends Identifiable<?>, ?>>() {{
        put(User.class, new InMemoryUserStore());
    }};

    @Override
    protected Map<Class<? extends Identifiable<?>>, Store<? extends Identifiable<?>, ?>> stores() {
        return stores;
    }

}
